﻿<!DOCTYPE HTML>
<html>

<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
  <link href="static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
  <link href="static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
  <link href="static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
  <link href="lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
  <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<!--<script>DD_belatedPNG.fix('*');</script>-->
<!--[endif]-->
  <title>小聚后台管理系统</title>
  <script>
    (function () {
        $.ajax({
          url: '../Api/index.php?p=back&m=index&a=isLogin',
          type: 'POST',
          dataType: 'json',
          data: {
          },
        }).done(function (data) {
          // console.log(data)
          if (data.code == 200) {
            // console.log(data)
            window.location.href = 'index.html'
          } else {
            // window.location.href = "login.html";
          }
        }).fail(function (data) {
          console.log(data);
        });
      })()
  </script>
  <style>
    .header {
      color: #ffffff;
      line-height: 60px;
      font-size: 25px;
      padding-left: 20px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <input type="hidden" id="TenantId" name="TenantId" value="" />
  <div class="header">
    小聚后台管理系统
  </div>
  <div class="loginWraper">
    <div id="loginform" class="loginBox">
      <div class="form form-horizontal">
        <div class="row cl">
          <label class="form-label col-xs-3">
            <i class="Hui-iconfont">&#xe60d;</i>
          </label>
          <div class="formControls col-xs-8">
            <input id="" name="" type="text" placeholder="账户" class="input-text size-L username">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-xs-3">
            <i class="Hui-iconfont">&#xe60e;</i>
          </label>
          <div class="formControls col-xs-8">
            <input name="" type="password" placeholder="密码" class="input-text size-L password">
          </div>
        </div>
        <div class="row cl">
          <div class="formControls col-xs-8 col-xs-offset-3">
            <input class="input-text size-L yzm" type="text" placeholder="验证码" value="" style="width:150px;">
            <img src="./static/img/verification.php">
            <a id="kanbuq" href="javascript:kbq();">看不清，换一张</a>
          </div>
        </div>
        <div class="row cl">
          <div class="formControls col-xs-8 col-xs-offset-3">
            <label for="online">
              <input type="checkbox" name="online" id="online" value=""> 使我保持登录状态
            </label>
          </div>
        </div>
        <div class="row cl">
          <div class="formControls col-xs-8 col-xs-offset-3">
            <input name="" type="submit" class="submit btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
            <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="footer">Copyright 小聚团队</div>
  <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
  <script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
  <!--此乃百度统计代码，请自行删除-->
  <script>
    var kbq = function () {
      document.querySelector('.formControls img').setAttribute('src', './static/img/verification.php')
    }

    document.querySelector('.submit').addEventListener('click', function () {
      // document.querySelector()
      var pwd = $('.password').val()
      var yzm = $('.yzm').val()
      var username = $('.username').val()
      // console.log(username)
        if(pwd != ''&& pwd != null && pwd != undefined){
          if(username != '' && username != null && username != undefined){
              if(yzm != '' && yzm != null && yzm != undefined){
                  $.ajax({
                      url: '../Api/index.php?p=back&m=index&a=login',
                      type: 'POST',
                      dataType: 'json',
                      data: {
                          user : username,
                          pwd : pwd,
                          yzm : yzm
                      },
                  }).done(function (data) {
                      // console.log(data);
                      if(data.code == 200){
                          window.location.href = 'index.html'
                      }else{
                          $('.password').val('')
                          $('.yzm').val('')
                          $('.username').val('')
                          document.querySelector('.formControls img').setAttribute('src', './static/img/verification.php')
                      }
                  }).fail(function (data) {
                      console.log(data);
                  });
              }
          }
        }

    })
  </script>
  <!-- 此乃百度统计代码，请自行删除 -->
</body>

</html>